'use strict';
app.service('rechargeConfigureService',['$http','$q','utilService',function($http,$q,utilService){
    var _this_=this;

    _this_.add=function($scope){
        var deferred = $q.defer();
        utilService.api({
            url:$scope.app.domain + 'recharge/configure',
            data:_this_.rebateCategoryAddVO
        }).then(function(result){
            deferred.resolve(result);
        });
        return deferred.promise;

    }

    _this_.rechargeConfigureEditVO={};
    _this_.findById=function($scope){
        var deferred = $q.defer();
        utilService.get({
            url:$scope.app.domain + 'recharge/configure/'+_this_.rechargeConfigureEditVO.id
        }).then(function(result){
            deferred.resolve(result);
        });
        return deferred.promise;

    }

    _this_.edit=function($scope){
        var deferred = $q.defer();
        utilService.api({
            url:$scope.app.domain + 'recharge/configure',
            data:_this_.rechargeConfigureEditVO,
            method:'PUT'
        }).then(function(result){
            deferred.resolve(result);
        });
        return deferred.promise;

    }

    _this_.delete=function($scope){
        var deferred = $q.defer();
        utilService.api({
            url:$scope.app.domain + 'recharge/configure/'+$scope.modal.data.id,
            method:'DELETE'
        }).then(function(result){
            deferred.resolve(result);
        });
        return deferred.promise;

    }
}]);